import com.sun.org.apache.xerces.internal.util.DOMEntityResolverWrapper;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: XMQ
 * Date: 2022-06-16
 * Time: 15:19
 */
class SpaceShipContorls{
    void up(int distance){};
    void down(int distance){};
    void left(int distance){};
    void rigth(int distance){};
}

class SpaceShipDelegation{
    private String name;
    private SpaceShipContorls spaceShipContorls = new SpaceShipContorls();

    public SpaceShipDelegation(String name) {
        this.name = name;
    }

    //agency
    //Delegated methods
    public void up(int distance) {
        spaceShipContorls.up(distance);
    }

    public void down(int distance) {
        spaceShipContorls.down(distance);
    }

    public void left(int distance) {
        spaceShipContorls.left(distance);
    }

    public void rigth(int distance) {
        spaceShipContorls.rigth(distance);
    }

    public static void main(String[] args) {
        SpaceShipDelegation spaceShipDelegation = new SpaceShipDelegation("yuh1号");
        spaceShipDelegation.up(10);
    }
}
class A{
    public A(){
        System.out.println("A Constructor");
    }
}
class B{
    public B(){
        System.out.println("B Constructor");
    }
};
class C extends A{
    B b;//组合会调用构造器嘛？ NO

    public static void main(String[] args) {
        C c = new C();
    }
}
class Art{
    public Art(){
        System.out.println("Art Constructor");
    }
}
class Drawing extends Art{
    public Drawing(){
        System.out.println("Drawing Constructor");
    }
}
class Carton extends Drawing{
    public static void main(String[] args) {
        Carton carton = new Carton();
    }
}
public class TestDemo1 {
}
